package br.com.fmu.projeto_android_tcc_2014;

import br.com.fmu.android_tcc_2014.adapter.Lista_Alunos_Adapter;
import br.com.fmu.projeto_android_tcc_2014.dao.Android_TCC_DAO;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

public class Android_TCC_2014 extends Activity {

    private Android_TCC_DAO dao;
    private Lista_Alunos_Adapter list_adapter;
    
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_android__tcc_2014);
        
        dao = new Android_TCC_DAO(this);
    }
	
	@Override
	protected void onResume() {
		super.onResume();
		
		list_adapter = new Lista_Alunos_Adapter();
		list_adapter.geraListView(dao, Android_TCC_2014.this);
		
	}
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
    	
        getMenuInflater().inflate(R.menu.activity_android__tcc_2014, menu);
        return true;
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
    	
    	switch(item.getItemId()) {
    	case R.id.menu_novo:
    		Intent intent = new Intent(Android_TCC_2014.this, TCC_Formulario_Activity.class);
    		startActivity(intent);
    	}
    	
    	return super.onOptionsItemSelected(item);
    }
}
